Table.toJSON

Returns a JSON string representing all rows in the table, this is the same as #toJSON() but additionally provides an option on how null values in table columns are handled. Columns with a null value can either be omitted or included as value "null".
 {
  rows:
   [
    {Name:Smith, Age:31, StartDate:1459206000000},
    {Name:Mendez, Age:23, StartDate:1462306000000},
    {Name:Jones, Age:null, StartDate:null}
   ]
 }   
 
The JSON string contains a single "rows" property which contains an array of table rows where each row contains columnName:value property pairs where the value for each column is the same as its value property, see Field#getValue(). when excludeNullValues is true, columns with null values are omitted. When excludeNullValues is false, columns with null values are included with value "null" - see example above;

Examples:

 // 1. send to REST web service
 var ordersJson = tables.ORDERS.toJSON(true);
 services.rest.put("http://example.com/rest/orders", ordersJson);
 // 2. convert to Javascript object
 var ordersJson = tables.ORDERS.toJSON(true);
 var ordersObj = JSON.parse(ordersJson);
 var order1Value = ordersObj.rows[0].orderValue;
 var order2Id = ordersObj.rows[1].orderId;
 for each (var order in ordersObj.rows)
 {
   var id = order.orderId;
   var orderDate = order.orderDate;
 } 
 

returns java.lang.String

Parameters

boolean  excludeNullValues,